package net.zoneland.knowledge.config;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * Aop配置类.
 * @author zmq
 * 2021/10/21 14:57
 */
@Configuration
@EnableAspectJAutoProxy
public class AopConfig {
    /**
     * 是否开启监控.
     */
    private static boolean stopWatchEnabledConst;

    /**
     * 是否开启性能监控.
     */
    @Value("${stop.watch.enabled:false}")
    private boolean stopWatchEnabled;

    /**
     * 获取 是否开启监控.
     * @return 是否开启监控
     */
    public static boolean isStopWatchEnabledConst() {
        return stopWatchEnabledConst;
    }

    /**
     * bean加载后执行.
     */
    @PostConstruct
    public void postConstruct() {
        stopWatchEnabledConst = stopWatchEnabled;
    }
}
